﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Hardanger.Model;
using Hardanger.Features.ServerFuzzer;

namespace Hardanger.View
{
	/// <summary>
	/// Interaction logic for ResultsView.xaml
	/// </summary>
	public partial class ResultsView : UserControl
	{
		public ResultsView()
		{
			InitializeComponent();
		}
		void OnResultsListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
		{			
			if (e.Handled)
				return;
			
			ListViewItem lvi = (ListViewItem)sender;
			Type viewType = lvi.DataContext.GetType();

			switch(viewType.ToString())
			{
				case "Hardanger.Features.ServerFuzzer.ServerFuzzerResult":
					ServerFuzzerResult fr = (ServerFuzzerResult)lvi.DataContext;
                    ShowDetails(fr);
					break;
				default:
					break;
			}
			e.Handled = true;				
		}

        private void ShowDetails(ServerFuzzerResult fr)
        {
            var rd = new ResultsDetails();
            rd.DataContext = fr;
            rd.Show();
        }

        
	}

	

}
